package cn.ltgodm.template.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ltgodm.template.user.domain.entity.RoleDept;
import cn.ltgodm.template.user.service.RoleDeptService;
import cn.ltgodm.template.user.mapper.RoleDeptMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;

/**
* @author wenpeng
* @description 针对表【lt_role_dept(角色和部门关联表)】的数据库操作Service实现
* @createDate 2024-03-17 22:12:11
*/
@Service
public class RoleDeptServiceImpl extends ServiceImpl<RoleDeptMapper, RoleDept> implements RoleDeptService{

    @Resource
    private RoleDeptMapper roleDeptMapper;

    /**
     * 删除角色和部门关联
     * @param roleIds 角色id
     */
    @Override
    public void removeRoleDept(Long[] roleIds) {
        LambdaQueryWrapper<RoleDept> lqw = new LambdaQueryWrapper<>();
        lqw.in(RoleDept::getRoleId, Arrays.asList(roleIds));
        roleDeptMapper.delete(lqw);
    }
}




